<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../00_static/js/vue.js" type="text/javascript"></script>
    <title>基本列表</title>
</head>

<body>
    <!-- 
        v-for指令：
            1. 用于展示列表数据
            2. 语法：v-for="(value,index) in car" :key="value.id"
            3. 可遍历：数组、对象
     -->

    <div id="app">
        <ul>
            <!-- 遍历数组 -->
            <h3>人员信息</h3>
            <li v-for="p in persons" :key="p.id">
                {{p.name}}--{{p.sex}}--{{p.age}}岁
            </li>

            <!-- 遍历对象 -->
            <h3>汽车信息</h3>
            <li v-for="(value,key) in car" :key="key">
                {{value}}
            </li>
        </ul>
    </div>

    <script type="text/javascript">
        new Vue({
            el: "#app",
            data: {
                persons: [
                    { id: '001', name: '张三', age: 20, sex: '男' },
                    { id: '002', name: '李四', age: 21, sex: '女' },
                    { id: '003', name: '王五', age: 22, sex: '男' },
                    { id: '004', name: '赵六', age: 23, sex: '女' },
                ],
                car: { name: '汽车', price: '100W', color: '多彩' }
            }
        })
    </script>
</body>

</html>